/*
 * @Author: kanglang
 * @Date: 2021-02-23 11:22:57
 * @LastEditors: kanglang
 * @LastEditTime: 2021-03-11 11:19:56
 * @Description: 私有图片查看器封装
 */

import React from 'react';
import { backWhite } from '@/images';
import ImageViewer from '@/components/XmImageViewer';

const ExampleImager = ({
  modalVisible,
  type,
  onChange
}) => {
  const showViewModal = () => {
    onChange && onChange();
  };

  const checkTemp = () => {
    let tempImgs = [];
    if (type == 1) { // 企业执照
      tempImgs = [{ url: 'https://xmgj2020-prod.oss-cn-chengdu.aliyuncs.com/businessExample/023C5048CEC147F694DRR1E1C748B1D1.jpg' }];
    } else if (type == 2) { // 法人身份证
      tempImgs = [
        { url: 'https://xmgj2020-prod.oss-cn-chengdu.aliyuncs.com/businessExample/023C5048CEC147F694DRR1E1C748B1D4.jpg' },
        { url: 'https://xmgj2020-prod.oss-cn-chengdu.aliyuncs.com/businessExample/023C5048CEC147F694DRR1E1C748B1D5.jpg' }
      ];
    } else if (type == 3) { // 对公账户
      tempImgs = [{ url: 'https://xmgj2020-prod.oss-cn-chengdu.aliyuncs.com/businessExample/023C5048CEC147F694DRR1E1C748B1D6.jpg' }];
    } else if (type == 4) { // 管理员授权书
      tempImgs = [
        { url: 'https://xmgj2020-prod.oss-cn-chengdu.aliyuncs.com/businessExample/023C5048CEC147F694DRR1E1C748B1D2.jpg' },
        { url: 'https://xmgj2020-prod.oss-cn-chengdu.aliyuncs.com/businessExample/023C5048CEC147F694DRR1E1C748B1D3.jpg' }
      ];
    }
    return tempImgs;
  };

  return (
    <ImageViewer
      leftBackIcon={backWhite}
      showViewModal={showViewModal}
      previewModal={modalVisible}
      images={checkTemp()}
    />
  );
};
export default ExampleImager;
